package com.itheima.googleplay9.holder;

import android.graphics.BitmapFactory;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.itheima.googleplay9.R;
import com.itheima.googleplay9.api.Url;
import com.itheima.googleplay9.bean.Subject;
import com.itheima.googleplay9.global.GooglePlayApp;
import com.itheima.googleplay9.global.ImageLoaderOptions;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer;
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;

import butterknife.Bind;

/**
 * Created by lxj on 2016/5/24.
 */
public class SubjectHolder extends BaseHolder<Subject> {
    @Bind(R.id.iv_image)
    ImageView ivImage;
    @Bind(R.id.tv_des)
    TextView tvDes;

    @Override
    protected View initHolderView() {
        View view = View.inflate(GooglePlayApp.context, R.layout.adapter_subject, null);
        return view;
    }

    @Override
    public void bindData(Subject data) {
        tvDes.setText(data.getDes());
        ImageLoader.getInstance().displayImage(Url.IMAGE_PREFIX+data.getUrl()
        ,ivImage, ImageLoaderOptions.options);
    }
}
